﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MAPDavy.Entities;

namespace MAPDavy.Repository
{
    public class StudentRepository:MasterRepository,IStudentRepository
    {
        public int AddStudent(Student student)
        {
            var ok = 0;

            var existe = (from s in Context.Students
                                 where s.Id == student.Id
                                 select s).SingleOrDefault();

            if (existe == null)
            {
                Context.Students.Add(student);
                Context.SaveChanges();
            }

            return ok;
        }
    }
}
